package edu.bbu.license.client.android.utility;

import edu.bbu.license.client.android.application.MainApplication;
import android.content.Context;
import android.content.SharedPreferences;

public class PersistenceProvider {
	
	private static final String PREF_NAME = "ANDROID_MONGODB_FS_CLIENT_PREFS";
	private SharedPreferences sharedPreferences;
	
	public PersistenceProvider() {
		sharedPreferences = MainApplication.getInstance().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
	}
	
	public synchronized void saveValue(String key, String value) {
		sharedPreferences.edit().putString(key, value).commit();
	}
	
	public synchronized void removeValue(String key) {
		sharedPreferences.edit().remove(key).commit();
	}
	
	public synchronized String getValue(String key) {
		return sharedPreferences.getString(key, "");
	}
}
